(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, n^1).


The TRS R consists of the following rules:

f(g(X), Y) → f(X, n__f(n__g(X), activate(Y)))
f(X1, X2) → n__f(X1, X2)
g(X) → n__g(X)
activate(n__f(X1, X2)) → f(activate(X1), X2)
activate(n__g(X)) → g(activate(X))
activate(X) → X

Rewrite Strategy: INNERMOST

(1) TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID) transformation)

Transformed TRS to weighted TRS

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, n^1).


The TRS R consists of the following rules:

f(g(X), Y) → f(X, n__f(n__g(X), activate(Y))) [1]
f(X1, X2) → n__f(X1, X2) [1]
g(X) → n__g(X) [1]
activate(n__f(X1, X2)) → f(activate(X1), X2) [1]
activate(n__g(X)) → g(activate(X)) [1]
activate(X) → X [1]

Rewrite Strategy: INNERMOST

(3) InnermostUnusableRulesProof (BOTH BOUNDS(ID, ID) transformation)

Removed the following rules with non-basic left-hand side, as they cannot be used in innermost rewriting:

f(g(X), Y) → f(X, n__f(n__g(X), activate(Y))) [1]

Due to the following rules that have to be used instead:

g(X) → n__g(X) [1]

(4) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, n^1).


The TRS R consists of the following rules:

f(X1, X2) → n__f(X1, X2) [1]
g(X) → n__g(X) [1]
activate(n__f(X1, X2)) → f(activate(X1), X2) [1]
activate(n__g(X)) → g(activate(X)) [1]
activate(X) → X [1]

Rewrite Strategy: INNERMOST

(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(6) Obligation:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

f(X1, X2) → n__f(X1, X2) [1]
g(X) → n__g(X) [1]
activate(n__f(X1, X2)) → f(activate(X1), X2) [1]
activate(n__g(X)) → g(activate(X)) [1]
activate(X) → X [1]

The TRS has the following type information:
f :: n__f:n__g → a → n__f:n__g
n__f :: n__f:n__g → a → n__f:n__g
g :: n__f:n__g → n__f:n__g
n__g :: n__f:n__g → n__f:n__g
activate :: n__f:n__g → n__f:n__g

Rewrite Strategy: INNERMOST

(7) CompletionProof (UPPER BOUND(ID) transformation)

The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added:
none

And the following fresh constants:

const, const1

(8) Obligation:

Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

f(X1, X2) → n__f(X1, X2) [1]
g(X) → n__g(X) [1]
activate(n__f(X1, X2)) → f(activate(X1), X2) [1]
activate(n__g(X)) → g(activate(X)) [1]
activate(X) → X [1]

The TRS has the following type information:
f :: n__f:n__g → a → n__f:n__g
n__f :: n__f:n__g → a → n__f:n__g
g :: n__f:n__g → n__f:n__g
n__g :: n__f:n__g → n__f:n__g
activate :: n__f:n__g → n__f:n__g
const :: n__f:n__g
const1 :: a

Rewrite Strategy: INNERMOST

(9) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID) transformation)

Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction.
The constant constructors are abstracted as follows:

const => 0
const1 => 0

(10) Obligation:

Complexity RNTS consisting of the following rules:

activate(z) -{ 1 }→ X :|: X >= 0, z = X
activate(z) -{ 1 }→ g(activate(X)) :|: z = 1 + X, X >= 0
activate(z) -{ 1 }→ f(activate(X1), X2) :|: X1 >= 0, X2 >= 0, z = 1 + X1 + X2
f(z, z') -{ 1 }→ 1 + X1 + X2 :|: X1 >= 0, X2 >= 0, z = X1, z' = X2
g(z) -{ 1 }→ 1 + X :|: X >= 0, z = X

Only complete derivations are relevant for the runtime complexity.

(11) CompleteCoflocoProof (EQUIVALENT transformation)

Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo:

eq(start(V, V1),0,[f(V, V1, Out)],[V >= 0,V1 >= 0]).
eq(start(V, V1),0,[g(V, Out)],[V >= 0]).
eq(start(V, V1),0,[activate(V, Out)],[V >= 0]).
eq(f(V, V1, Out),1,[],[Out = 1 + X11 + X21,X11 >= 0,X21 >= 0,V = X11,V1 = X21]).
eq(g(V, Out),1,[],[Out = 1 + X3,X3 >= 0,V = X3]).
eq(activate(V, Out),1,[activate(X12, Ret0),f(Ret0, X22, Ret)],[Out = Ret,X12 >= 0,X22 >= 0,V = 1 + X12 + X22]).
eq(activate(V, Out),1,[activate(X4, Ret01),g(Ret01, Ret1)],[Out = Ret1,V = 1 + X4,X4 >= 0]).
eq(activate(V, Out),1,[],[Out = X5,X5 >= 0,V = X5]).
input_output_vars(f(V,V1,Out),[V,V1],[Out]).
input_output_vars(g(V,Out),[V],[Out]).
input_output_vars(activate(V,Out),[V],[Out]).

CoFloCo proof output:
Preprocessing Cost Relations
=====================================

#### Computed strongly connected components
0. non_recursive : [f/3]
1. non_recursive : [g/2]
2. recursive [non_tail] : [activate/2]
3. non_recursive : [start/2]

#### Obtained direct recursion through partial evaluation
0. SCC is completely evaluated into other SCCs
1. SCC is completely evaluated into other SCCs
2. SCC is partially evaluated into activate/2
3. SCC is partially evaluated into start/2

Control-Flow Refinement of Cost Relations
=====================================

### Specialization of cost equations activate/2
* CE 5 is refined into CE [6]
* CE 4 is refined into CE [7]


### Cost equations --> "Loop" of activate/2
* CEs [7] --> Loop 4
* CEs [6] --> Loop 5

### Ranking functions of CR activate(V,Out)
* RF of phase [4]: [V]

#### Partial ranking functions of CR activate(V,Out)
* Partial RF of phase [4]:
- RF of loop [4:1]:
V


### Specialization of cost equations start/2
* CE 2 is refined into CE [8]
* CE 3 is refined into CE [9]


### Cost equations --> "Loop" of start/2
* CEs [8,9] --> Loop 6

### Ranking functions of CR start(V,V1)

#### Partial ranking functions of CR start(V,V1)


Computing Bounds
=====================================

#### Cost of chains of activate(V,Out):
* Chain [[4],5]: 2*it(4)+1
Such that:it(4) =< Out

with precondition: [Out=V,Out>=1]

* Chain [5]: 1
with precondition: [V=Out,V>=0]


#### Cost of chains of start(V,V1):
* Chain [6]: 2*s(2)+1
Such that:s(2) =< V

with precondition: [V>=0]


Closed-form bounds of start(V,V1):
-------------------------------------
* Chain [6] with precondition: [V>=0]
- Upper bound: 2*V+1
- Complexity: n

### Maximum cost of start(V,V1): 2*V+1
Asymptotic class: n
* Total analysis performed in 43 ms.

(12) BOUNDS(1, n^1)